<template>
	<view>
		<u-navbar :is-back="false" title="　" :border-bottom="false">
			<view class="u-flex u-row-right" style="width: 100%;">
				<view class="camera u-flex u-row-center">
				</view>
			</view>
		</u-navbar>
		<view class="u-flex user-box u-p-l-30 u-p-r-20 u-p-b-30">
			<view class="u-m-r-10">
				<u-avatar :src="form.imageUrl" size="140"></u-avatar>
			</view>
			<view class="u-flex-1">
				<view class="u-font-18 u-p-b-20" v-model="form.userName">{{form.userName}}</view>
				<view class="u-font-14 u-tips-color" v-model="form.jobNumber">员工工号:{{form.jobNumber}}</view>
			</view>
		</view>
		
		<view class="u-m-t-20">
			<u-cell-group>
				<u-cell-item icon="account" title="个人信息" @click="toPersonInfo"></u-cell-item>
			</u-cell-group>
		</view>
		
		<view class="u-m-t-20">
			<u-cell-group>
				<u-cell-item icon="order" title="排产信息" @click="toPlanCheck"></u-cell-item>
				<u-cell-item icon="order" title="打卡" @click="toclockIn"></u-cell-item>
				<u-cell-item icon="list" title="员工信息" @click="tostaffInfo"></u-cell-item>
				<u-cell-item icon="thumb-up-fill" title="员工评分" @click="tostaffRate"></u-cell-item>
				<u-cell-item icon="chat" title="温馨提示" @click="toReminder"></u-cell-item>
				<u-cell-item icon="photo" title="结束码" @click="toEndCode"></u-cell-item>
				<u-cell-item icon="order" title="员工扫码记录" @click="toRecord" v-if="form.lineType == 1 || form.lineType == 3"></u-cell-item>
				<u-cell-item icon="error-circle" title="异常报警" @click="toDealError" v-if="form.departmentName != '数控车间'"></u-cell-item>
				<u-cell-item icon="red-packet" title="绩效查询" @click="toPerformancePage"></u-cell-item>
				<u-cell-item icon="file-text" title="维修记录" @click="toFeedBackForm"></u-cell-item>
			</u-cell-group>
		</view>
		<view class="u-m-t-20" v-if="form.departmentName == '数控车间' || form.departmentName == '焊接车间'">
			<u-cell-group>
				<u-cell-item icon="list" title="工单绑定机台切换确认" @click="toMachineSwitch"></u-cell-item>
				<u-cell-item icon="bell" title="机台状态" @click="toMachineStatus"></u-cell-item>
				<u-cell-item icon="lock-opened-fill" title="员工机台解绑" @click="toUnbind"></u-cell-item>
				<u-cell-item icon="error-circle" title="机台异常报警" @click="toDealError1"></u-cell-item>
				<u-cell-item icon="red-packet" title="工单完成进度" @click="toOrderQuery" v-if="form.departmentName == '数控车间'"></u-cell-item>
				<u-cell-item icon="file-text" title="设备点检" @click="toSpotCheckList('设备点检')"></u-cell-item>
				<u-cell-item icon="file-text" title="设备保养" @click="toSpotCheckList('设备保养')"></u-cell-item>
			</u-cell-group>
		</view>
		<view class="u-m-t-20">
			<view class="_blank"></view>
		</view>
		</view>
	</view>
</template>

<script>
import { accessPersonInfo } from '../../../utils/index.js'
	export default {
		data() {
			return {
				form: {
					userName:'',		//用户姓名
					jobNumber:'',		//员工工号
					imageUrl:'',			//用户头像
					feedbackForm: uni.getStorageSync('feedbackForm'),
					user: uni.getStorageSync('user')
				}
			}
		},
		// 进入页面获取员工的信息
		onLoad() {
			this.getUserInfo()
		},
		methods: {
			toSpotCheckList(name){
							uni.navigateTo({
								url:'../../../publicPage/spotCheckList?name=' + name
							})
						},
			toFeedBackForm(){
				uni.navigateTo({
					url:'../../../publicPage/feedBackForm'
				})
			},
			// 个人信息页面跳转
			toPersonInfo(){
				uni.navigateTo({
					url:'../../../publicPage/personInfo'
				})
			},
			// 跳转绩效查询页面
			toPerformancePage(){
				uni.navigateTo({
					url:'../../../publicPage/performance'
				})
			},
			// 排产信息页面跳转
			toPlanCheck(){
				uni.navigateTo({
					url:'../childPage/planCheck'
				})
			},
			// 打卡
			toclockIn(){
				uni.navigateTo({
					url:'../childPage/clockIn'
				})
			},
			// 员工信息页面跳转
			tostaffInfo() {
				uni.navigateTo({
					url:'../childPage/staffInfo'
				})
			},
			// 员工评分
			tostaffRate() {
				uni.navigateTo({
					url:'../childPage/staffRate'
				})
			},
			// 温馨提示页面跳转
			toReminder() {
				uni.navigateTo({
					url:'../childPage/reminder'
				})
			},
			// 结束码页面跳转
			toEndCode() {
				uni.navigateTo({
					url:'../childPage/endCode'
				})
			},
			// 员工扫码记录
			toRecord(){
				uni.navigateTo({
					url:'../childPage/orderConfirm?sectionNo=' + this.form.sectionNo
				})
			},
			// 错误处理页面跳转
			toDealError() {
				uni.navigateTo({
					url:'../childPage/getErrorList'
				})
			},
			// 数控错误处理页面跳转
			toDealError1() {
				uni.navigateTo({
					url:'../childPage/getErrorList1'
				})
			},
			// 前往工单完成进度查询页面
			toOrderQuery() {
				uni.navigateTo({
					url:'/publicPage/orderQuery'
				})
			},
			// 员工机台解绑
			toUnbind(){
				uni.navigateTo({
					url:'../childPage/unBind'
				})
			},
			// 机台状态
			toMachineStatus(){
				uni.navigateTo({
					url:'../../../pagesA/publicPage/machineStatus'
				})
			},
			toMachineSwitch(){
				uni.navigateTo({
					url:'../childPage/machineSwitch'
				})
			},
			// 获取个人信息的函数
			// 获取员工信息赋值给form
			async getUserInfo(){
				const {data} = await accessPersonInfo()
				this.form = Object.assign({},data.data)
			}
		}
	}
</script>

<style lang="scss">
page{
	background-color: #ededed;
}
.user-box{
	background-color: #fff;
}
._blank{
	width: 100%;
	height: 68rpx;
}
</style>